package zy1208.zy11;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Properties;
import java.util.Set;

public class demo {
    public static void main(String[] args) throws IOException {
        java.lang.String[] arr = {"uid=001," +
                "username=jack," +
                "password=123"};
        Properties p = new Properties();
        for (java.lang.String s : arr) {
            java.lang.String[] split = s.split(",");
            for (int i = 0; i < split.length; i++) {
                String[] split1 = split[i].split("=");
                p.setProperty(split1[0],split1[1]);
            }
        }
        StringBuilder str = new StringBuilder();
        Set<String> keys = p.stringPropertyNames();
        for (String x : keys) {
            str.append(x+p.getProperty(x));
        }
        FileWriter out = new FileWriter("D:\\ideadashuju12\\liu_ya_kai\\src\\zy1208\\zy11\\t4.properties");
        p.store(out,str.toString());
        out.close();
    }
}
